/*
 * REFXMLSchemaAttDef.h
 *
 *  Created on: Apr 1, 2013
 *      Author: Lucifer
 */

#ifndef	__BFX_REFXMLSCHEMAATTDEF_H__
#define	__BFX_REFXMLSCHEMAATTDEF_H__

#include "REFXMLSchemaAttribute.h"
#include "REFXMLSchemaDecl.h"

namespace BFX
{
//////////////////////////////////////////////////////////////////////////////

// This class describes an attribute type and potential values.
// This encapsulates the information for one Attdef * in an Attlist in a DTD as described below:
class REFXMLSchemaAttDef : public REFXMLSchemaDecl
{
public:
	enum Reserve
	{
		ReserveNone,
		ReserveXmlSpace,
		ReserveXmlLang
	};

public:
	REFXMLSchemaAttDef(REFXMLQualifiedName* pName, const UniString& strPrefix);
	virtual ~REFXMLSchemaAttDef();

	Reserve GetReserved() const;
	void SetReserved(Reserve reserved);

	REFXMLSchemaAttribute* GetSchemaAttribute() const;
	void SetSchemaAttribute(REFXMLSchemaAttribute* pSchemaAttribute);
	UniString GetDefaultValueExpanded() const;
	void SetDefaultValueExpanded(const UniString& strValue);

private:
	Reserve		m_reserved;			// indicate the attribute type, such as xml:lang or xml:space
	UniString	m_strDefExpanded;	// default value in its expanded form
	REF<REFXMLSchemaAttribute>	m_pSchemaAttribute;
};

//////////////////////////////////////////////////////////////////////////////

inline REFXMLSchemaAttDef::REFXMLSchemaAttDef(REFXMLQualifiedName* pName, const UniString& strPrefix)
	: REFXMLSchemaDecl(pName, strPrefix)
{
	m_reserved = ReserveNone;
}

inline REFXMLSchemaAttDef::~REFXMLSchemaAttDef()
{
}

inline REFXMLSchemaAttDef::Reserve REFXMLSchemaAttDef::GetReserved() const
{
	return m_reserved;
}
inline void REFXMLSchemaAttDef::SetReserved(Reserve reserved)
{
	m_reserved = reserved;
}

inline REFXMLSchemaAttribute* REFXMLSchemaAttDef::GetSchemaAttribute() const
{
	return m_pSchemaAttribute;
}
inline void REFXMLSchemaAttDef::SetSchemaAttribute(REFXMLSchemaAttribute* pSchemaAttribute)
{
	m_pSchemaAttribute = pSchemaAttribute;
}

inline UniString REFXMLSchemaAttDef::GetDefaultValueExpanded() const
{
	return m_strDefExpanded;
}
inline void REFXMLSchemaAttDef::SetDefaultValueExpanded(const UniString& strValue)
{
	m_strDefExpanded = strValue;
}

//////////////////////////////////////////////////////////////////////////////

typedef REFWrapper<Array<REF<REFXMLSchemaAttDef> > > REFXMLSchemaAttDefArray;
typedef REFWrapper<HashMap<REF<REFXMLQualifiedName>, REF<REFXMLSchemaAttDef> > > REFXMLSchemaAttDefMap;

}	//	namespace BFX

#endif	//	__BFX_REFXMLSCHEMAATTDEF_H__
